<?php
/**
 * Created by PhpStorm.
 * User: jz
 * Date: 16/7/13
 * Time: 下午6:12
 */
require_once ('bookmark_fns.php');
session_start();

$url = $_POST['url'];

do_html_header('添加标签');

try{
    check_valid_user();
    if (!filled_out($_POST)){
        throw new Exception('请输入url');
    }
    if (!is_url($url)){
        throw new Exception('请输入有效的url');
    }
    add_bm($url);
    echo '添加成功';
    if (($urls = get_user_urls($_SESSION['valid_user']))){
       display_user_urls($urls); 
    }
}catch(Exception $e){
   echo $e->getMessage(); 
}
display_user_menu();
do_html_footer();
